# -*- coding: utf-8 -*-

from core.resources import CustomerModelResource
from import_export.fields import Field
from import_export.widgets import ForeignKeyWidget
from apps.rms.models import Interface
from apps.pms.models import Product
from apps.rms.protocol.widget import *


class InterfaceResouces(CustomerModelResource):
    product = Field(attribute='product',
                    widget=ForeignKeyWidget(Product, field='name'))

    class Meta:
        model = Interface
        fields = ('name', 'product', 'type', 'remark')
        import_id_fields = ('name', 'product', )
        export_order = fields
